Got the servlet working , but I am still unable to figure out what I should modify in the servlet to make it a bot . I have moved the code from main to init method of the servlet .
What else needs to chnage in servlet code
my Init method looks like this
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
// Redirect STD output and STD error
// Set Sametime debug level
try {
PrintStream ps;
ps = new PrintStream(
new FileOutputStream("/dataserver/logs/ST-log.txt"));
System.setOut(ps);
System.setErr(ps);
Debug.m_debugLevel = 5;
}
catch (FileNotFoundException e) {
}
// Init Sametime
log("initialize sametime");
initSametime();
// Wait until initialization complete
try
{
synchronized(this)
{
wait();
}
}
catch (InterruptedException e)
{
}
log(">> Sametime servlet was initialized successfully");
}
/**
* Initialize Sametime and save references to Sametime Services
**/
void initSametime()
{
// Create the session, load components and start it
try
{
m_session = new STSession("" + this );
loadComponents();
m_session.loadSemanticComponents();
m_session.start();
}
catch (DuplicateObjectException e)
{
e.printStackTrace();
}
// Save references for later use
LookupService lookup = (LookupService)m_session.getCompApi(LookupService.COMP_NAME);
m_resolver = lookup.createResolver(true, true, true, true);
m_resolver.addResolveListener(this);
m_session.getCompApi(LookupService.COMP_NAME);
m_saService = (ServerAppService) m_session.getCompApi(ServerAppService.COMP_NAME);
m_storageService = (SAppStorageService) m_session.getCompApi(SAppStorageService.COMP_NAME);
m_tokenService = (SATokenService) m_session.getCompApi(SATokenService.COMP_NAME);
m_tokenService.addTokenServiceListener(this);
m_blService = (BLService) m_session.getCompApi(BLService.COMP_NAME);
commService = (CommunityService)m_session.getCompApi(CommunityService.COMP_NAME);
commService.addLoginListener(this);
// Login to the server
loginToServer("bhst01.verizon.com");
}
void loginToServer(String serverName)
{
m_saService.addLoginListener(this);
short loginType = STUserInstance.LT_USER_JAVA_APP;
Connection[] connections = {
new SocketConnection(1516, 17000), };
m_saService.setConnectivity(connections);
log(">> login to sametime server name is " + serverName);
m_saService.loginAsServerApp( serverName, loginType,"iBPMServlet", null);
log("Bot login ");
commService.loginByPassword(serverName, "dc36wbl", "eg%4rTH0");
log("Bot login ");
}
public void loggedIn(LoginEvent event)
{
log(">> loggedIn to Sametime");
m_storageService.addStorageServiceListener(this);
imService = (InstantMessagingService)m_session.getCompApi(InstantMessagingService.COMP_NAME);
imService.registerImType(ImTypes.IM_TYPE_CHAT);
imService.addImServiceListener(this);
confService = (ConfService)m_session.getCompApi(ConfService.COMP_NAME);
}
the loggedIn method implemented what I have for my java bot code .
When I start my web server , this servlet throws some error code
[30/Jan/2007:17:08:19] info ( 4950): WEB2798: [] ServletContext.log(): iBPMServlet: initialize sametime
[30/Jan/2007:17:08:21] info ( 4950): WEB2798: [] ServletContext.log(): iBPMServlet: >> login to sametime server name is bhst01.verizon.com
[30/Jan/2007:17:08:21] info ( 4950): WEB2798: [] ServletContext.log(): iBPMServlet: >> Sametime servlet was initialized successfully
[30/Jan/2007:17:08:23] info ( 4950): HTTP3072: [LS ls1]
http://localhost.localdomain:8000 ready to accept requests
[30/Jan/2007:17:08:23] info ( 4950): CORE3274: successful server startup
[30/Jan/2007:17:08:25] info ( 4985): WEB2798: [] ServletContext.log(): iBPMServlet: ***** loggedOut from Sametime reason = -2147483645
[30/Jan/2007:17:08:25] info ( 4985): WEB2798: [] ServletContext.log(): iBPMServlet: ***** loggedOut from Sametime reason = -2147483645
[30/Jan/2007:17:18:34] info ( 4950): CORE5073: Web server shutdown in progress
Have I missed the bus on this one completely .
Please please help !!!
thanks in advance .. any light on this matter will help
Thanks Alpa